//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.comleader.operator.service;

import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.core.row.Db;
import com.mybatisflex.core.table.TableInfo;
import com.mybatisflex.core.table.TableInfoFactory;
import com.mybatisflex.spring.service.impl.ServiceImpl;

import cn.hutool.core.util.StrUtil;


public class CustomService<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> {

    /**
     * @Description 清空表数据
     * @Auhtor 连新景
     * @Date 2024/08/27 17:37
     * @param clazz
     * @return int
     */
    public int truncate(Class<T> clazz) {
        TableInfo tableInfo = TableInfoFactory.ofEntityClass(clazz);
        return Db.deleteBySql(StrUtil.format("TRUNCATE TABLE {};", tableInfo.getTableName()));
    }
}
